#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    static const int N = 8;
    int c[N][N] = {0};

    void init()
    {
        c[0][0] = 1;
        for (int i = 1; i <= N; i++)
        {
            c[i][0] = 1;
            for (int j = 1; j <= i; j++)
                c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
        }
    }
    int paintingPlan(int n, int k)
    {
        init();
        if (k % n)
            return 0;
        if (n * n == k)
            return 1;
        return c[n][k / n] * 2;
    }
};

int main()
{
    int n, k;
    cin >> n >> k;
    Solution s;
    cout << s.paintingPlan(n, k) << endl;
    return 0;
}
